package org.bbelovic.devel.pexeso.gui;

import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JLabel;

public class PairsLabel extends JLabel {

    private static final long serialVersionUID = -9089978656983027594L;
    private final Icon defaultIcon;
    private final Icon flagIcon;

    public PairsLabel(Icon flagIcon) {
        this.defaultIcon = new ImageIcon(Frame.IMAGE_DIR + "/black.GIF");
        this.flagIcon = flagIcon;
        setIcon(defaultIcon);
    }
    
    public void turnFlagIcon() 
    {
        setIcon(flagIcon);
    }
    
    public void turnDefaultIcon() {
        setIcon(defaultIcon);
    }
    
    @Override
    public boolean equals(Object o) {
        if (!(o instanceof PairsLabel))
        {
            return false;
        }
        final PairsLabel other = (PairsLabel) o;
        final String otherIcon = other.flagIcon.toString();
        return otherIcon.equals(flagIcon.toString());
    }
    
    
}
